#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<cstdio>

using namespace std;

int main()
{
    int A, B, time;
    cin >> A >> B;
    if (A == B)
    {
        time = 24;
        printf("O JOGO DUROU %d HORA(S)\n", time);
    }
    else if (A < B)
    {
        time = B - A;
        printf("O JOGO DUROU %d HORA(S)\n", time);
    }
    else
    {
        time = 24 - A + B;
        printf("O JOGO DUROU %d HORA(S)\n", time);
    }
    return 0;
}
